import { createStore } from "vuex";
import { login } from "../api/request";

export default createStore({
  state: {},
  getters: {},
  mutations: {
    login(state, token) {},
  },
  actions: {
    login({ commit }, obj) {
      return new Promise((reslove) => {
        login(obj).then((res) => {
          if (res.success) {
            reslove(res);
            localStorage.setItem("token", "Bearer" + res.data.token);
          }
        });
      });
    },
  },
  modules: {},
});
